package com.example.demo.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.Objects;

@Entity
public class Jzgxinfo {
    private int jzgxId;
    private String xm;
    private BigDecimal price;
    private Date fxdate;
    private String jznl;
    private String jzfa;
    private String ys;
    private String ls;
    private String ydcl;
    private String scyf;
    private String bz;
    private Client kh;
    private Xsjhinfo xsjh;
    private Jpinfo jp;

    @Id
    @Column(name = "jzgxId", nullable = false)
    public int getJzgxId() {
        return jzgxId;
    }

    public void setJzgxId(int jzgxId) {
        this.jzgxId = jzgxId;
    }

    @Basic
    @Column(name = "xm", nullable = true, length = 50)
    public String getXm() {
        return xm;
    }

    public void setXm(String xm) {
        this.xm = xm;
    }

    @Basic
    @Column(name = "price", nullable = true, precision = 2)
    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    @Basic
    @Column(name = "fxdate", nullable = true)
    public Date getFxdate() {
        return fxdate;
    }

    public void setFxdate(Date fxdate) {
        this.fxdate = fxdate;
    }

    @Basic
    @Column(name = "jznl", nullable = true, length = 10)
    public String getJznl() {
        return jznl;
    }

    public void setJznl(String jznl) {
        this.jznl = jznl;
    }

    @Basic
    @Column(name = "jzfa", nullable = true, length = 50)
    public String getJzfa() {
        return jzfa;
    }

    public void setJzfa(String jzfa) {
        this.jzfa = jzfa;
    }

    @Basic
    @Column(name = "ys", nullable = true, length = 50)
    public String getYs() {
        return ys;
    }

    public void setYs(String ys) {
        this.ys = ys;
    }

    @Basic
    @Column(name = "ls", nullable = true, length = 50)
    public String getLs() {
        return ls;
    }

    public void setLs(String ls) {
        this.ls = ls;
    }

    @Basic
    @Column(name = "ydcl", nullable = true, length = 50)
    public String getYdcl() {
        return ydcl;
    }

    public void setYdcl(String ydcl) {
        this.ydcl = ydcl;
    }

    @Basic
    @Column(name = "scyf", nullable = true, length = 2)
    public String getScyf() {
        return scyf;
    }

    public void setScyf(String scyf) {
        this.scyf = scyf;
    }

    @Basic
    @Column(name = "bz", nullable = true, length = 50)
    public String getBz() {
        return bz;
    }

    public void setBz(String bz) {
        this.bz = bz;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Jzgxinfo jzgxinfo = (Jzgxinfo) o;
        return jzgxId == jzgxinfo.jzgxId &&
                Objects.equals(xm, jzgxinfo.xm) &&
                Objects.equals(price, jzgxinfo.price) &&
                Objects.equals(fxdate, jzgxinfo.fxdate) &&
                Objects.equals(jznl, jzgxinfo.jznl) &&
                Objects.equals(jzfa, jzgxinfo.jzfa) &&
                Objects.equals(ys, jzgxinfo.ys) &&
                Objects.equals(ls, jzgxinfo.ls) &&
                Objects.equals(ydcl, jzgxinfo.ydcl) &&
                Objects.equals(scyf, jzgxinfo.scyf) &&
                Objects.equals(bz, jzgxinfo.bz);
    }

    @Override
    public int hashCode() {
        return Objects.hash(jzgxId, xm, price, fxdate, jznl, jzfa, ys, ls, ydcl, scyf, bz);
    }

    @ManyToOne
    @JoinColumn(name = "khId", referencedColumnName = "client_id")
    public Client getKh() {
        return kh;
    }

    public void setKh(Client kh) {
        this.kh = kh;
    }

    @ManyToOne
    @JoinColumn(name = "xsjhId", referencedColumnName = "xsjhId")
    public Xsjhinfo getXsjh() {
        return xsjh;
    }

    public void setXsjh(Xsjhinfo xsjh) {
        this.xsjh = xsjh;
    }

    @ManyToOne
    @JoinColumn(name = "jpId", referencedColumnName = "jpId")
    public Jpinfo getJp() {
        return jp;
    }

    public void setJp(Jpinfo jp) {
        this.jp = jp;
    }
}
